//
//  UIBarButtonItem+kqyExtension.m
//  百思不得姐os1
//
//  Created by kqy on 8/2/16.
//  Copyright © 2016 kqy. All rights reserved.
//

#import "UIBarButtonItem+kqyExtension.h"

@implementation UIBarButtonItem (kqyExtension)
+ (instancetype) buttonItemTitle:(NSString *) title andImage:(NSString *)image andSelectedImage:(NSString *) selectedImage andAction:(SEL) action andTarger:(id) target{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:selectedImage] forState:UIControlStateHighlighted];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [button sizeToFit];
    UIBarButtonItem *barItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    return barItem;
}
@end
